package com.test;

import java.io.File;
import java.util.List;

import com.isea.easyxls.ImpXls2ListObj;
import com.project.bean.AccountDocument;
import com.project.bean.MoneyRecord;
import com.project.bean.PersonnalDocument;
import com.project.bean.TransactionGather;
import com.project.dao.implement.AccountDocumentMapperExtImpl;
import com.project.dao.implement.MoneyRecordMapperExtImpl;
import com.project.dao.implement.PersonnalDocumentMapperExtImpl;
import com.project.dao.implement.TransactionGatherMapperExtImpl;
import com.project.utils.Constants;

public class testEasyXml {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try {
		String xmlPath = "D:\\workSpace\\PoliceProjectFromGoogle\\src\\resources\\ExcelTransactionGatherMap.xml";
		String xmlPath2 = "D:\\workSpace\\PoliceProjectFromGoogle\\src\\resources\\ExcelAccountDocumentMap.xml";
		String xmlPath3 = "D:\\workSpace\\PoliceProjectFromGoogle\\src\\resources\\ExcelMoneyRecordMap.xml";
		String xmlPath4 = "D:\\workSpace\\PoliceProjectFromGoogle\\src\\resources\\ExcelPersonnalDocumentMap.xml";
		String filePath = Constants.destPath+"/";          
		String fileName = "GA_数据库-01_编号调整.xls";         
		File file = new File(filePath+fileName);  
		List<TransactionGather> list;
		List<AccountDocument> list2;
		List<MoneyRecord> list3;
		List<PersonnalDocument> list4;
		//List<MoneyRecord> sublist;
		TransactionGather moneyRecord;
		list = (List<TransactionGather>) ImpXls2ListObj.impXls2ListObj(xmlPath,file);

		//System.out.println(list.get(0).toString());
		//TransactionGatherMapperExtImpl tra = new TransactionGatherMapperExtImpl();
		//tra.insertBatch(list);
		list2 = (List<AccountDocument>) ImpXls2ListObj.impXls2ListObj(xmlPath2,file);
		list3 = (List<MoneyRecord>) ImpXls2ListObj.impXls2ListObj(xmlPath3,file);
		list4 = (List<PersonnalDocument>) ImpXls2ListObj.impXls2ListObj(xmlPath4,file);
		AccountDocumentMapperExtImpl acc = new AccountDocumentMapperExtImpl();
		PersonnalDocumentMapperExtImpl per = new PersonnalDocumentMapperExtImpl();
		TransactionGatherMapperExtImpl tra = new TransactionGatherMapperExtImpl();
		MoneyRecordMapperExtImpl moneyrecordMapp = new MoneyRecordMapperExtImpl();
		moneyrecordMapp.insertBatch(list3);
		acc.insertBatch(list2);
		per.insertBatch(list4);
     	tra.insertBatch(list);
		/*for(int i = 0;i<list.size();i++)
		{
			moneyRecord = list.get(i);
			System.out.println(moneyRecord.toString());
		}*/
		
		/*List<PersonnalDocument> list;
		//List<MoneyRecord> sublist;
		PersonnalDocument moneyRecord;
		list = (List<PersonnalDocument>) ImpXls2ListObj.impXls2ListObj(xmlPath,file);
		for(int i = 0;i<list.size();i++)
		{
			moneyRecord = list.get(i);
			System.out.println(moneyRecord.toString());
		}*/
		/*List<MoneyRecord> list;
		List<MoneyRecord> sublist;
		MoneyRecord moneyRecord;
		list = (List<MoneyRecord>) ImpXls2ListObj.impXls2ListObj(xmlPath,file);
		MoneyRecordMapperExtImpl moneyrecordMapp = new MoneyRecordMapperExtImpl();
		moneyrecordMapp.insertBatch(list);
		System.out.println("over");*/
		/*for(int i = 0;i<list.size();i++)
		{
			moneyRecord = list.get(i);
			System.out.println(moneyRecord.toString());
		}*/
		/*for(TestObj testObj:list){            
			System.out.println(testObj.getName()+","+testObj.getAge()+","+testObj.getCountry());
		
		}*/
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}   
	}

}
